﻿//菜单上按钮操作

var bMenuState = true;
function setMenuHide() {
    //打开或隐藏菜单

    if (bMenuState) {
        bMenuState = false;
        if (getBrowser() != 6) {
            $("#navigation").css({ width: "0%" });
            $("#content").css({ width: "98%" });
        }
        else {
            $("#navigation").css({ width: "0px" });
            var w = ($("#content").width() + 210) + "px";
            $("#content").css({ width: w });
        }
        document.getElementById("htmlSubHeader").style.display = "none";
        document.getElementById("htmlMenuPanel").style.display = "none";
        document.getElementById("htmlMenuSelect").style.display = "none";
        document.getElementById("DivMid").innerHTML = "<img src='images/Stretch02.gif' height='31' width='9' />";
    }
    else {
        //隐藏菜单
        //width:20%;
        bMenuState = true;
        if (getBrowser() != 6) {
            $("#navigation").css({ width: "16%" });
            $("#content").css({ width: "81.5%" });
        }
        else {
            $("#navigation").css({ width: "210px" });
            var w = ($("#PageForm").width() - 230) + "px";
            $("#content").css("","100%");
        }

        document.getElementById("htmlSubHeader").style.display = "";
        document.getElementById("htmlMenuPanel").style.display = "";
        document.getElementById("htmlMenuSelect").style.display = "";
        document.getElementById("DivMid").innerHTML = "<img src='images/Stretch.gif' height='31' width='9' />";
    }
}

function resizeWindow() {
    var windowHeight = getWindowHeight();
//    if (document.getElementById("navigation").clientHeight > windowHeight) {
//        windowHeight = document.getElementById("navigation").clientHeight + 225;
//    }
    
    if (document.getElementById("content") != null) {
        document.getElementById("content").style.height = (windowHeight - 113) + "px";
        document.getElementById("DivMid").style.height = (windowHeight - 113) + "px";
        if (getBrowser() == 6) {
            var w = ($("#PageForm").width() - 230) + "px";
            $("#content").css({ width: w });
        }
    }


    if (document.getElementById("contentPanel") != null) {
//        if (document.getElementById("htmlMenuPanel") != null && document.getElementById("htmlMenu") != null)
        document.getElementById("contentPanel").style.height = (windowHeight - 154) + "px";
          // document.getElementById("contentPanel").style.height = document.getElementById("htmlMenuPanel").clientHeight + document.getElementById("htmlMenu").clientHeight + "px";
    }

    if (document.getElementById("navigation") != null) {
     //   if (document.getElementById("htmlMenuPanel") != null && document.getElementById("htmlMenu") != null)
       //     document.getElementById("navigation").style.height = document.getElementById("htmlMenuPanel").clientHeight + document.getElementById("htmlMenu").clientHeight + "px";
        document.getElementById("navigation").style.height = document.getElementById("navigation").clientHeight + "px";
    }

}


function getWindowHeight() {
    var windowHeight = 0;
    if (typeof (window.innerHeight) == 'number') {
        windowHeight = window.innerHeight;
    }
    else {
        if (document.documentElement && document.documentElement.clientHeight) {
            windowHeight = document.documentElement.clientHeight;
        }
        else {
            if (document.body && document.body.clientHeight) {
                windowHeight = document.body.clientHeight;
            }
        }
    }
    return windowHeight;
}


function getBrowser() {
    var agt = navigator.userAgent.toLowerCase();
    var appVer = navigator.appVersion.toLowerCase();

    //*** Browser Version ***
    var is_minor = parseFloat(appVer);
    var is_major = parseInt(is_minor);

    // alert(agt.toString());
    //alert(appVer.toString());

    var iePos = appVer.indexOf("msie");
    if (iePos != -1) {
        is_minor = parseFloat(appVer.substring(iePos + 5, appVer.indexOf(";", iePos)));
        is_major = parseInt(is_minor);

    }
    return is_major;
}